package com.example.it_game;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

import com.vaadin.Application;
import com.vaadin.ui.*;

public class It_gameApplication extends Application {
	private static final String QUERY = null;

	@Override
		public void init() {
		Connection conn = null; 
		String userName = "root";
		String password = "obivan1";
		String url = "jdbc:mysql://localhost/it_game_users";
		
// my_sql test		
		try{
			Class.forName ("com.mysql.jdbc.Driver").newInstance ();
			conn = DriverManager.getConnection (url, userName, password);
			System.out.println ("Database connection established");
			//HI!
		}catch (ClassNotFoundException cnfe){
			System.err.println("not Driver");
		}catch (SQLException sqle){
			System.err.println("not Database ");
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block\
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			try{
				if (conn != null) conn.close();
			}catch (SQLException sqle){
				System.err.println("Error close DB");
			}
		}
		
		
		
		
		
		    Window main = new Window("The Main Window");
			setMainWindow(main);
			main.addComponent(new WindowOpener("Window Opener", main));
			setTheme("gametheme");
			}
	
	}




